<template>
  <div>
    <van-nav-bar title="业务管理" />

    <van-collapse v-model="activeName" accordion>
      <template v-for="menu in menus">
        <van-collapse-item
          :key="menu.name"
          :title="menu.title"
          :name="menu.name"
        >
          <template v-for="(item, index) in menu.children || []">
            <van-cell
              :key="index"
              :title="item.title"
              is-link
              :to="`/web?action=${item.action}`"
            />
          </template>
        </van-collapse-item>
      </template>
    </van-collapse>
  </div>
</template>

<script>
// import api from '@/odooapi'

const menus = [
  {
    name: 'contacts',
    title: '参与人',
    children: [
      { title: '参与人', action: 'contacts.action_contacts' },
      { title: '参与人标签', action: 'base.action_partner_category_form' },
      { title: '参与人称谓', action: 'base.action_partner_title_contact' },
      { title: '国家', action: 'base.action_country' },
      { title: '省/州', action: 'base.action_country_state' },
      { title: '国家组', action: 'base.action_country_group' },
      { title: '银行', action: 'base.action_res_bank_form' },
      {
        title: '银行账户',
        action: 'base.action_res_partner_bank_account_form'
      }
    ]
  },
  {
    name: 'product',
    title: '产品管理',
    children: [
      { title: '产品', action: 'account.product_product_action_sellable' }
    ]
  },
  {
    name: 'sale',
    title: '销售管理',
    children: [
      { title: '销售报价单', action: 'sale.action_quotations_with_onboarding' },
      { title: '客户', action: 'account.res_partner_action_customer' },
      { title: '产品', action: 'account.product_product_action_sellable' }
    ]
  },
  {
    name: 'purchase',
    title: '采购管理',
    children: [
      { title: '采购订单', action: 'sale.action_quotations_with_onboarding' },
      { title: '供应商', action: 'account.res_partner_action_customer' },
      { title: '产品', action: 'account.product_product_action_sellable' }
    ]
  },
  {
    name: 'cash',
    title: '出纳业务',
    children: [
      { title: '收款', action: 'sale.action_quotations_with_onboarding' },
      { title: '付款', action: 'account.res_partner_action_customer' },
      { title: '内部转账', action: 'account.product_product_action_sellable' }
    ]
  },
  {
    name: 'finance',
    title: '会计业务',
    children: [
      { title: '会计凭证', action: 'sale.action_quotations_with_onboarding' },
      { title: '账簿设置', action: 'account.res_partner_action_customer' },
      { title: '会计科目', action: 'account.product_product_action_sellable' }
    ]
  }
]

export default {
  name: 'Home',
  components: {},
  mixins: [],

  data() {
    return {
      activeName: '',
      menus
    }
  },
  computed: {},
  async created() {},

  methods: {}
}
</script>

<style type="text/css"></style>
